home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE14 / TREE / UNIT1.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1996-08-21  |  1.3 KB  |  57 lines

  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, ExtCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Panel1: TPanel;
  12.     LabelInitDir: TLabel;
  13.     EditInitDirectory: TEdit;
  14.     ButtonListFiles: TButton;
  15.     ListBox1: TListBox;
  16.     ButtonDeleteDirs: TButton;
  17.     procedure ButtonListFilesClick(Sender: TObject);
  18.     procedure ButtonDeleteDirsClick(Sender: TObject);
  19.   private
  20.     { Private declarations }
  21.   public
  22.     { Public declarations }
  23.   end;
  24.  
  25. var
  26.   Form1: TForm1;
  27.  
  28. implementation
  29.  
  30. {$R *.DFM}
  31.  
  32. uses FileList, DelDirs;
  33.  
  34. procedure TForm1.ButtonListFilesClick(Sender: TObject);
  35. var
  36.    FileList: TFileList;
  37. begin
  38.      FileList:= TFileList.Create (EditInitDirectory.Text,True);
  39.      try
  40.         ListBox1.Items.Clear;
  41.         ListBox1.Items.Assign(FileList.Files_Found);
  42.      finally
  43.             FileList.Free;
  44.      end;
  45. end;
  46.  
  47. procedure TForm1.ButtonDeleteDirsClick(Sender: TObject);
  48. begin
  49.      if MessageDlg( 'Are you sure you want to delete the directory ' +
  50.                     '''' + EditInitDirectory.Text + '''' +
  51.                     ' and its sub-directories ?',
  52.                     mtConfirmation,[mbYes,mbNo],0) = mrYes then
  53.                     Delete_Tree ( EditInitDirectory.Text );
  54. end;
  55.  
  56. end.
  57.